﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;
using DcsGauges.Shared.Exceptions;

namespace DcsGauges.Shared.DataStructures
{
    public abstract class IntervalGen<T>
    {
        public T               Begin;
        public T               End;

        public IntervalGen(T begin, T end)
        {
            this.Begin          = begin;
            this.End            = end;
        }
    }


    public class Interval : IntervalGen<float>
    {
        public Interval(float begin, float end) : base(begin, end)
        {
            if(begin >= end) throw new ArgumentException(Localization.ExcBeginGreaterEnd);
            Contract.EndContractBlock();
        }

        [ContractInvariantMethod]
        private void ContractInvariant()
        {
            Contract.Invariant(base.Begin < base.End);
        }

    }
}
